home *** CD-ROM | disk | FTP | other *** search
- /************************/
- /** REXX:COMPRESS.REXX **/
- /************************/
- /* BY RICK TILLERY */
- /************************/
-
- /* ------------------------------------ */
- /* | THIS SCRIPT RUNS WITH ADPRO 2.0. | */
- /* ------------------------------------ */
-
- /* Through some experimentation with ADPro, LZ and GIF compression, I've */
- /* COME UP WITH THIS SCRIPT. JPEG IMAGE COMPRESSION IS VERY NICE FOR */
- /* come up with this script for the compression of 24 bit images. JPEG */
- /* image compression is VERY nice for rather complicated images, (such */
- /* as complex ray-traces, digitized pics, and scans) where it's losses */
- /* are not readily apparent. But for the majority of ray-traced and */
- /* hand-drawn pictures, a passable JPEG compressed file is almost as */
- /* large as (or larger in a very few cases) the original IFF 24 file. */
-
- /* (NOTE: DCTV and HAM-E users will not notice the degradation until a */
- /* much lower Q rating is used. Toaster, FireCracker24, Rembrant, */
- /* Harlequin, IV24, and other full 24 bit board owners will be very */
- /* thankful if you distribute the original 24 bit data, and let their */
- /* particular device degrade it as it must.) */
-
- /* When I separated out the red, green and blue components of some 24 */
- /* bit pics and then created three separate GIF files from them, I */
- /* noticed that the resulting GIF files were extremely small. Earlier, */
- /* I had purported that taking the raw sculpt files (red, green and */
- /* blue) and compressing them with LZ (or LHArc) was the best non-lossy */
- /* method of transferring 24 bit pics. This was indeed smaller than the */
- /* IFF 24 files compressed or not. This GIF method usually results in */
- /* files at least half as large as that! So, until I can author my own */
- /* IFF LZW format (along with suitable encode/decode programs), I offer */
- /* this script and its companion for lossless 24 bit image compression. */
- /* Give it a try, and see what you think. */
-
- /* Instructions: 1. Move input file(s) to a HD partition with at least */
- /* WIDTH x HEIGHT x 3 x 2 free bytes (i.e. 768 x 480 */
- /* x 3 x 2 = 2,211,840 bytes) */
- /* 2. Run ADPro 2.0 */
- /* 3. Run this script */
- /* 4. Use ADPro requester to give name of input file */
- /* 5. WAIT - this script with produce an archive of the */
- /* three GIF files that you can upload */
-
- /* Portal: RTillery (RTillery@cup.portal.com) */
-
-
-
- /* Open port to ADPro - it must be running first */
- ADDRESS "ADPro"
-
- /* Turn on results flag to get data FROM ADPro... */
- /* ...and set loader/saver formats */
- OPTIONS RESULTS
- LFORMAT "UNIVERSAL"
- SFORMAT "SCULPT"
-
- /* Ask user for input file */
- LOAD '"' || '"'
-
- /* Get name of input file from ADPro for script manipulation */
- LAST_LOADED_IMAGE
- FILE = ADPRO_RESULT
-
- /* First of the three Sculpt format raw files */
- OUTFILE = FILE||'.red'
-
- /* Save the raw image info in three separate red, green and blue files */
- SAVE OUTFILE RAW
-
- /* THE FOLLOWING CODE IS FOR COMPARISON OF LZH COMPRESSION OF THE RAW */
- /* SCULPT FILES TO THEIR GIF EQUIVALENTS. TO DO THIS COMPARISON, */
- /* DELETE THE COMMENT SYMBOLS (/* */) HERE AND AT THE END OF THIS */
- /* SCRIPT. */
-
- /*
- ADPRO_TO_BACK
-
- /* Access DOS */
- ADDRESS "COMMAND"
-
- /* Clear CLI script was called from */
- 'ECHO' '"*E[0;0H*E[J"'
- /* Archive three raw image files */
- 'LZ' A FILE||'.SCULPT.LZH' FILE||'.#?'
- /* NOTE: Don't forget that the raw files have no image size info, so if */
- /* for some reason you want to send the above archive somewhere, */
- /* you must add a file letting the recipient know what the */
- /* image's dimensions are. */
-
- ADDRESS "ADPro"
-
- ADPRO_TO_FRONT
- */
-
- /* Get Width of loaded image from ADPro */
- XSIZE
- WIDTH = ADPRO_RESULT
-
- /* Get Height of loaded image from ADPro */
- YSIZE
- HEIGHT = ADPRO_RESULT
-
- /* Create blank image same size as input image */
- LFORMAT "BACKDROP"
- LOAD "dummy" WIDTH HEIGHT GRAY
-
- /* And save it */
- SAVE FILE||'.GRAY1' RAW
-
- /* Get ready to read in raw files */
- LFORMAT 'SCULPT'
-
- /* Access to DOS */
- ADDRESS "COMMAND"
-
- /* We need two copies of that blank image because ADPro requires there */
- /* be three separate files for the Sculpt loader from AREXX */
- 'COPY' FILE||'.GRAY1' FILE||'.GRAY2'
- /* Replace Green file with blank file */
- 'RENAME' FILE||'.GRN' FILE||'.GOLD'
- 'RENAME' FILE||.'GRAY1' FILE||.'GRN'
- /* Replace Blue file with blank file */
- 'RENAME' FILE||'.BLU' FILE||'.BOLD'
- 'RENAME' FILE||'.GRAY2' FILE||'.BLU'
-
- ADDRESS "ADPro"
-
- /* Get raw data but since Green and Blue are blank, it's only Red data */
- LOAD OUTFILE WIDTH HEIGHT COLOR
-
- /* Create 256 color rendition for GIF image */
- RENDER_TYPE '256'
- EXECUTE
-
- /* Save GIF file */
- SFORMAT 'GIF'
- SAVE FILE||.'RED.GIF' IMAGE
-
- /***********************************************************************/
- /* From here on out, we do the same thing as above with the Green and */
- /* Blue data */
- /***********************************************************************/
-
- ADDRESS "COMMAND"
-
- 'RENAME' FILE||'.RED' FILE||'.ROLD'
- 'RENAME' FILE||'.GRN' FILE||'.RED'
- 'RENAME' FILE||'.GOLD' FILE||'.GRN'
-
- ADDRESS "ADPro"
-
- LOAD OUTFILE WIDTH HEIGHT COLOR
-
- RENDER_TYPE '256'
- EXECUTE
-
- SAVE FILE||.'GREEN.GIF' IMAGE
-
- ADDRESS "COMMAND"
-
- 'RENAME' FILE||'.GRN' FILE||'.GOLD'
- 'RENAME' FILE||'.BLU' FILE||'.GRN'
- 'RENAME' FILE||'.BOLD' FILE||'.BLU'
-
- ADDRESS "ADPro"
-
- LOAD OUTFILE WIDTH HEIGHT COLOR
-
- RENDER_TYPE '256'
- EXECUTE
-
- SAVE FILE||.'BLUE.GIF' IMAGE
-
- ADPRO_TO_BACK
-
- ADDRESS "COMMAND"
-
- /* Get rid of superfluous raw files */
- 'DELETE' '>NIL:' FILE||'.(RED|GRN|BLU|ROLD|GOLD)'
-
- /* Put three GIF files into archive WITHOUT trying to compress */
- 'LZ' '-z' A FILE||'.LZH' FILE||'#?GIF'
- /* Now get rid of GIF files */
- 'DELETE' '>NIL:' FILE||'*GIF'
-
- /* THE FOLLOWING COMMAND GOES WITH THE ABOVE CODE FOR LZH TO GIF COMPARE */
-
- /*
- LIST FILE||'#?'
- */
-
-
-
-